
package com.kweative.lingua.server.structures;

import java.util.HashMap;
import java.util.Map;

/**
 *
 * @author henrik
 */
public class NamedPool<K,V> implements IPool {
    private Map<K,V> pool;

    public NamedPool() {
        pool = new HashMap<K, V>();
    }
    public void add(K key,V value) {
        if (!has(key))
            pool.put(key, value);

    }
    public V get(K key) {
        if (has(key))
            return pool.get(key);
        return null;
    }
    public boolean has(K key) {
        return pool.containsKey(key);
    }
    public Map<K,V> getPool() {
        return pool;
    }
}
